<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div th:fragment="Navigationfragment" id="sidebar" class="sidebar py-3">
    <div class="text-gray-400 text-uppercase px-3 px-lg-4 py-4 font-weight-bold small headings-font-family">MAIN</div>
    <ul class="sidebar-menu list-unstyled">
        <li class="sidebar-list-item">
            <div class="text-muted">
                <div class="createbtndiv">
                    <button style="text-align: center;margin-left: auto;margin-right: auto" type="button" data-toggle="modal" data-target="#myModal" class="btn btn-primary createbtn" th:if="${session.connection}">新建数据库
                    </button>
                    <!-- Modal-->
                    <div id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
                         class="modal fade text-left" style="display: none;" aria-hidden="true">
                        <div role="document" class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 id="exampleModalLabel" class="modal-title">
                                        新建数据库
                                    </h4>
                                    <button type="button" data-dismiss="modal" aria-label="Close" class="close"><span
                                            aria-hidden="true">×</span></button>
                                </div>
                                <div class="modal-body">
                                    <form action="usercreatedatabase/createdb" method="post">
                                        <div class="form-group">
                                            <label>数据库名</label>
                                            <input type="text" name="dbname" placeholder="数据库名" class="form-control">
                                        </div>
                                        <div class="form-group">
                                            <label>字符集</label>
                                            <div class="select mb-3">
                                                <select name="charset" class="form-control">
                                                    <option>utf8</option>
                                                    <option>gbk</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" data-dismiss="modal" class="btn btn-secondary">取消</button>
                                            <button type="submit" class="btn btn-primary">创建</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </li>
        <li class="sidebar-list-item"><a href="#" data-toggle="collapse" data-target="#pages" aria-expanded="true"
                                         aria-controls="pages" class="sidebar-link text-muted"><i
                class="o-wireframe-1 mr-3 text-gray"></i><span>数据库</span></a></li>
        <div id="pages" class="collapse">
            <ul class="sidebar-menu list-unstyled border-left border-primary border-thick"
                th:each="cl:${session.schema_list}">
                <li class="sidebar-list-item"><a th:href="@{/usercreatetable/showtable/(schema=${cl})}"
                                                 class="sidebar-link text-muted pl-lg-5" th:text="${cl}"></a></li>
            </ul>
        </div>
        </li>
    </ul>
</div>
</html>


